<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>布艺文字</title>
  <style>
    body {margin: 0;overflow: hidden;}
    #canvas {background-color: antiquewhite;}
  </style>
</head>
<body>
  <canvas id="canvas"></canvas>
  <script>
    /** @type {HTMLCanvasElement} */
    const canvas = document.querySelector('#canvas');
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;
    const ctx = canvas.getContext('2d');

    /* 文字内容 */
    const text = 'canvas';

    /* 文字位置 */
    const [x,y] = [50,200];

    /* 字体属性: 文字加粗，大小200px 字体: arial */
    ctx.font = 'bold 200px arial';

    /* 投影: 颜色rgba(0,0,0.6) 垂直偏移2 模糊4 */
    ctx.shadowColor = 'rgba(0,0,0,0.6)';
    ctx.shadowOffsetY = 2;
    ctx.shadowBlur = 4;

    /* 填充文字: 颜色: #a76921 */
    ctx.fillStyle = '#a76921';
    ctx.fillText(text,x,y)

    /* 实线描边文字: 颜色: #f0d5ac 线宽8 */
    ctx.strokeStyle = '#f0d5ac';
    ctx.lineWidth = 8;
    ctx.strokeText(text,x,y);

    /* 虚线描边文字: 颜色: #333 线宽1 线段长度[5,3] */
    ctx.strokeStyle = '#333';
    ctx.lineWidth = 1;
    ctx.setLineDash([5,3]);
    ctx.strokeText(text,x,y);



  </script>
</body>
</html>